package demo10;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Scanner;

@SuppressWarnings({"all"})
public class Test {
    public static void main(String[] args) {
        //System.in;
        try(InputStream inputStream = new FileInputStream("d:/test.txt")){
            //这个时候的scanner就是从文件里面读取，而不是键盘读取
            Scanner scanner = new Scanner(inputStream);
            //使用scanner读取后续的内容
            String str=scanner.next();
            System.out.println(str);
        }catch(IOException e){
            e.printStackTrace();
        }
    }
}
